package database.util;

import java.io.InputStream;
import java.util.Properties;
import java.sql.Connection;
import java.sql.DriverManager;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import database.test.*;

@RunWith(Suite.class)
@Suite.SuiteClasses(
		{
			UserDaoTest.class
		}	
)

public class ConnectionUtil {
	
	private static String DRIVER;
	private static String URL;
	private static String USER;
	private static String PASSWORD;
	
	public static void initailDatabase(InputStream is) {
		try {
			Properties props = new Properties();
			props.load(is);
			DRIVER = props.getProperty("driver");
			URL = props.getProperty("url");
			USER = props.getProperty("user");
			PASSWORD = props.getProperty("password");
			Class.forName(DRIVER);
			is.close();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	public static Connection getConnection() throws Exception {
		Connection con = DriverManager.getConnection(URL, USER, PASSWORD);
		return con;
	}
	
	public static void main(String args[]){
		
	}
}
